import { getStore } from '@/util/store'
import { dateFormat } from '@/util/date'
const dic = {
  materialNature: [
    {
      label: '一般性物料',
      value: '1'
    },
    {
      label: '重点物料',
      value: '2'
    }
  ],
  materialClassify: [
    {
      label: '生产原辅料/成品/半成品',
      value: '1'
    },
    {
      label: '机物料',
      value: '2'
    },
    {
      label: '委外加工',
      value: '3'
    }
  ],
  isPass: [
    {
      label: '通过',
      value: '1'
    },
    {
      label: '不通过',
      value: '2'
    }
  ]
}

export const baseOption = function () {
  return {
    labelWidth: 120,
    emptyBtn: false,
    submitBtn: false,
    detail: ['view'].includes(this.type),
    column: [
      {
        label: '任务编号',
        span: 8,
        prop: 'taskCode',
        maxlength: 100,
        disabled: true
      },
      {
        label: '供应商名称',
        span: 8,
        prop: 'supplierName',
        formslot: true,
        rules: [
          {
            required: true,
            message: '请输入供应商名称',
            trigger: 'change'
          }
        ]
      },
      {
        label: '物料分类',
        prop: 'materialCategory',
        formslot: true,
        span: 8
      },
      {
        label: '拟供物料性质',
        prop: 'materialNature',
        type: 'radio',
        border: true,
        dicData: dic.materialNature,
        props: {
          label: 'label',
          value: 'value'
        },
        span: 8
      },
      {
        label: '拟供物料类别',
        prop: 'materialClassify',
        type: 'checkbox',
        border: true,
        dicData: dic.materialClassify,
        props: {
          label: 'label',
          value: 'value'
        },
        span: 12
      }
      // {
      //   label: '附件',
      //   prop: 'attachments',
      //   formslot: true,
      //   span: 24
      // }
    ]
  }
}
export const qualificationOption = function () {
  return {
    labelWidth: 120,
    emptyBtn: false,
    submitBtn: false,
    detail: ['view'].includes(this.type),
    column: [
      {
        label: '现场审核结果',
        prop: 'auditResult',
        type: 'textarea',
        maxlength: 500,
        minRows: 4,
        maxRows: 5,
        span: 24
      },
      {
        label: '潜在风险',
        prop: 'potentialRisk',
        type: 'textarea',
        maxlength: 500,
        minRows: 4,
        maxRows: 5,
        span: 24
      },
      {
        label: '附件',
        prop: 'attachments',
        formslot: true,
        span: 24
      }
    ]
  }
}
export const abilityOption = function () {
  return {
    labelWidth: 120,
    emptyBtn: false,
    submitBtn: false,
    detail: ['view'].includes(this.type),
    column: [
      {
        label: '现场审核结果',
        prop: 'abilityResult',
        type: 'textarea',
        maxlength: 500,
        minRows: 4,
        maxRows: 5,
        span: 24
      },
      {
        label: '潜在风险',
        prop: 'abilityPotentialRisk',
        type: 'textarea',
        maxlength: 500,
        minRows: 4,
        maxRows: 5,
        span: 24
      },
      {
        label: '附件',
        prop: 'abilityAttachments',
        formslot: true,
        span: 24
      }
    ]
  }
}
export const resultOption = function () {
  return {
    labelWidth: 120,
    emptyBtn: false,
    submitBtn: false,
    detail: ['view'].includes(this.type),
    column: [
      {
        label: '审核结果',
        prop: 'rResult',
        type: 'radio',
        dicData: dic.isPass,
        props: {
          label: 'label',
          value: 'value'
        },
        span: 8
      },
      {
        label: '结果说明',
        prop: 'resultPotentialRisk',
        type: 'textarea',
        maxlength: 500,
        minRows: 4,
        maxRows: 5,
        span: 24
      },
      {
        label: '附件',
        prop: 'resultAttachments',
        formslot: true,
        span: 24
      }
    ]
  }
}
